package com.myebills.ebpsfrontend.cust.controller;

import java.util.*;

public class EbppxBillDeliveryDataBean implements Comparator, java.io.Serializable {

	public static final int SORT_REQUEST_DATE = 0;
	public static final int SORT_STATEMENT_DATE = 1;
	public static final int SORT_STATUS = 2;
	public static final boolean SORT_ASC = true;
	public static final boolean SORT_DESC = false;

	private String acctNo="";
	private String stmtDate;
	private String reqOrSubscrDate;
	private String timeSent;
	private String emailAdd;
	private String status;
	private String mbxFile;
	private String strPhysicalBillSubscription="";
	private String strEBillSubscription="";
	private String strSMSNo="";
	private String strAcctSubscription="";
	private String strAcctDetailsEmailAdd="";
	private String strSMSSubscription="";


	private Date actualStmtDate;
	private Date openedDate;
	private Date actualReqOrSubscrDate;

	private boolean isSortAsc = true;
	private int sortType = 0;

	public EbppxBillDeliveryDataBean() {
		//empty constructor
	}

	//constructor for creating comparator
	public EbppxBillDeliveryDataBean(int sortType, boolean isSortAsc) {
		this.isSortAsc = isSortAsc;
		this.sortType = sortType;
	}

	//implementation for Comparator interface
	public int compare(Object o1, Object o2) {

		EbppxBillDeliveryDataBean r1 = (EbppxBillDeliveryDataBean)o1;
		EbppxBillDeliveryDataBean r2 = (EbppxBillDeliveryDataBean)o2;

		switch (sortType) {
			case SORT_REQUEST_DATE:
				if (isSortAsc) {
					return r1.getActualReqOrSubscrDate().compareTo(r2.getActualReqOrSubscrDate());
				} else {
					return -(r1.getActualReqOrSubscrDate().compareTo(r2.getActualReqOrSubscrDate()));
				}

			case SORT_STATEMENT_DATE:
				if (isSortAsc) {
					return r1.getActualStmtDate().compareTo(r2.getActualStmtDate());
				} else {
					return -(r1.getActualStmtDate().compareTo(r2.getActualStmtDate()));
				}

			case SORT_STATUS:
				if (isSortAsc) {
					return r1.getStatus().compareTo(r2.getStatus());
				} else {
					return -(r1.getStatus().compareTo(r2.getStatus()));
				}
		}
		return 0;
	}

	public void setAcctNo(String acctNo) {
		if(acctNo!=null){
			this.acctNo = acctNo;
		}
	}

	public String getAcctNo() {
		return this.acctNo;
	}

	public void setStmtDate(String stmtDate) {
		this.stmtDate = stmtDate;
	}

	public String getStmtDate() {
		return this.stmtDate;
	}

	public void setReqOrSubscrDate(String reqOrSubscrDate) {
		this.reqOrSubscrDate = reqOrSubscrDate;
	}

	public String getReqOrSubscrDate() {
		return this.reqOrSubscrDate;
	}

	public void setTimeSent(String timeSent) {
		this.timeSent = timeSent;
	}

	public String getTimeSent() {
		return this.timeSent;
	}

	public void setEmailAdd(String emailAdd) {
		this.emailAdd = emailAdd;
	}

	public String getEmailAdd() {
		return this.emailAdd;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getStatus() {
		if(this.status!=null && this.status.equals("PENDING")){
			this.status = "Sent";
		}
		return this.status;
	}

	public void setMbxFile(String mbxFile) {
		this.mbxFile = mbxFile;
	}

	public String getMbxFile() {
		return this.mbxFile;
	}

	public void setActualStmtDate(Date actualStmtDate) {
		this.actualStmtDate = actualStmtDate;
	}

	public Date getActualStmtDate() {
		return this.actualStmtDate;
	}

	public void setActualReqOrSubscrDate(Date actualReqOrSubscrDate) {
		this.actualReqOrSubscrDate = actualReqOrSubscrDate;
	}

	public Date getActualReqOrSubscrDate() {
		return this.actualReqOrSubscrDate;
	}

	public void setOpenedDate(Date openedDate) {
		this.openedDate = openedDate;
	}

	public Date getOpenedDate() {
		return this.openedDate;
	}
	// Added by Meau

	public void setPhysicalBillSubscription(String strPhysicalBillSubscription) {
		if(strPhysicalBillSubscription!=null){
			this.strPhysicalBillSubscription = strPhysicalBillSubscription;
		}
	}

	public String getPhysicalBillSubscription() {
		return this.strPhysicalBillSubscription;
	}

	public void setEBillSubscription(String strEBillSubscription) {
		if(strEBillSubscription!=null){
			this.strEBillSubscription = strEBillSubscription;
		}
	}

	public String getEBillSubscription() {
		return this.strEBillSubscription;
	}

	public void setSMSNo(String strSMSNo) {
		if(strSMSNo!=null){
			this.strSMSNo = strSMSNo;
		}
	}

	public String getSMSNo() {
		return this.strSMSNo;
	}

	public void setAcctSubscription(String strAcctSubscription) {
		if(strAcctSubscription!=null){
			this.strAcctSubscription = strAcctSubscription;
		}
	}

	public String getAcctSubscription() {
		return this.strAcctSubscription;
	}
	public void setAcctDetailsEmailAdd(String strAcctDetailsEmailAdd) {
		if(strAcctDetailsEmailAdd!=null){
			this.strAcctDetailsEmailAdd = strAcctDetailsEmailAdd;
		}
	}

	public String getAcctDetailsEmailAdd() {
		return this.strAcctDetailsEmailAdd;
	}

	public void setSMSSubscription(String strSMSSubscription) {
		if(strSMSSubscription!=null){
			this.strSMSSubscription = strSMSSubscription;
		}
	}

	public String getSMSSubscription() {
		return this.strSMSSubscription;
	}
	// end added by Meau

}
